<include file="Public/header1" title="组织架构列表" active="组织架构"  />
<link href="__PUBLIC__/css/owner.css" rel="stylesheet">
<div class="main">
    <div class="wrap">
        <include file="Public/sidebar" active="组织架构" />

        <div class="content">
            <div class="nav">
                <a href="{:U('addDepartment')}" class="add"><i></i><span>添加部门</span></a>
                <div class="search">
                    <form action="">
                    <input type="text" name="search" class="search-inner">
                    <div class="search-icon">
                        <button type="submit"></button>
                    </div>
                    </form>
                </div>
            </div>
            <table class="list">
                <thead>
                <tr>
                    <th>部门名称</th>
                    <th>上级部门</th>
                    <th>下级部门</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <volist name="depList" id="depItem">
                <tr>
                    <td>{$depItem['name']}</td>
                    <td><!--上一级--></td>
                    <td><!--下一级--></td>
                    <td>
                        <div style="display: inline-block">
                            <input type="checkbox" name="item[]" id="item{$depItem['chid']}" class="item statusItem" value="{$depItem['chid']}" <?php if($depItem['status']==1){?>checked<?php } ?>  />
                            <label class="ctrl" for="item{$depItem['chid']}">
                                <i></i>
                            </label>
                        </div>
                    </td>
                    <td>
                        <a href="{:U('editDepartment')}?chid={$depItem.chid}" class="modify">修改</a>
                    </td>
                </tr>
                </volist>
                </tbody>
            </table>
            <div class="controls">
                <div class="pagers">
                    {$page}
                </div>

            </div>
        </div>

        <div class="clr"></div>
    </div>
</div>
<script>
    $(function(){
        $("#checkAll").click(function(){
            if($(this).is(":checked")){
                $(".checkAll").find('input').prop("checked",true);
            }else{
                $(".checkAll").find('input').prop("checked",false);
            }
        });
        $(".statusItem").click(function (e) {
            e.preventDefault();
            var _this=this;
            $.get("{:U('setDepartmentStatus')}",{chid:$(_this).val()},function(data){
                if(data.status){
                    $(_this).prop('checked',data.info);
                }
            })
        })

    })
</script>
<include file="Public/footer" />